home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / src / WBBump_src.lha / WBBump_src / Notify.e < prev    next >
Encoding:
Text File  |  1999-06-30  |  1.6 KB  |  77 lines

  1. /* ******** */
  2. /* Notify.e */
  3. /* ******** */
  4.  
  5.  
  6.  
  7. /*
  8.     WBBump - Bumpmapping on the Workbench!
  9.  
  10.     Copyright (C) 1999  Thomas Jensen - dm98411@edb.tietgen.dk
  11.  
  12.     This program is free software; you can redistribute it and/or modify
  13.     it under the terms of the GNU General Public License as published by
  14.     the Free Software Foundation; either version 2 of the License, or
  15.     (at your option) any later version.
  16.  
  17.     This program is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.     GNU General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU General Public License
  23.     along with this program; if not, write to the Free Software Foundation,
  24.     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  25. */
  26.  
  27.  
  28.  
  29.  
  30. OPT MODULE
  31.  
  32.  
  33. MODULE    'dos/notify'
  34.  
  35.  
  36. EXPORT OBJECT notify OF notifyrequest
  37.     succes
  38. ENDOBJECT
  39.  
  40.  
  41. PROC notify(filename:PTR TO CHAR) OF notify HANDLE
  42.     DEF    signum=-1
  43.  
  44.     self.succes := TRUE
  45.  
  46.     self.name := filename
  47.     self.flags := NRF_SEND_SIGNAL
  48.     self.port := FindTask(NIL)
  49.     signum := AllocSignal(-1)
  50.     IF self.signalnum = -1 THEN Raise(-1)
  51.     self.signalnum := signum
  52.  
  53.     IF StartNotify(self) = FALSE THEN Raise(-1)
  54.  
  55. EXCEPT DO
  56.     IF exception THEN self.succes := FALSE
  57. ENDPROC
  58.  
  59.  
  60. PROC end() OF notify
  61.     IF self.succes THEN EndNotify(self)
  62. ENDPROC
  63.  
  64.  
  65. PROC haschanged() OF notify
  66.     IF self.succes
  67.         IF (SetSignal(0, Shl(1, self.signalnum)) AND Shl(1, self.signalnum)) THEN RETURN TRUE
  68.     ENDIF
  69. ENDPROC FALSE
  70.  
  71. PROC waitchange(othersigs=NIL) OF notify
  72.     IF self.succes
  73.         Wait(othersigs OR Shl(1, self.signalnum))
  74.     ENDIF
  75. ENDPROC
  76.  
  77.